package com.baizhi;

import com.baizhi.entity.Shop;
import com.baizhi.service.IShopService;
import com.baizhi.service.IVoucherService;
import com.baizhi.utils.RedisConstants;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.data.geo.Point;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.test.context.junit4.SpringRunner;

import java.util.List;

@RunWith(SpringRunner.class)
@SpringBootTest(classes= YuyousheApplication.class)
public class zuobiao {
    @Autowired
    private IShopService shopService;
    @Autowired
    private RedisTemplate redisTemplate;
    @Test
    public void test1(){
        List<Shop> list = shopService.list();
        for (Shop shop:list){
            String key = RedisConstants.SHOP_GEO_KEY+shop.getTypeId();
            redisTemplate.opsForGeo().add(key,new Point(shop.getX(),shop.getY()),shop.getId());
        }

    }
}
